//
//  NSDictionary+Mylog.m
//  ThinkSNS（探索版）
//
//  Created by IMAC on 2017/2/11.
//  Copyright © 2017年 zhiyicx. All rights reserved.
//

#import "NSDictionary+Mylog.h"

@implementation NSDictionary (Mylog)
- (NSString *)descriptionWithLocale:(id)locale
 {
         NSArray *allKeys = [self allKeys];
         NSMutableString *str = [[NSMutableString alloc] initWithFormat:@"{\t\n "];
         for (NSString *key in allKeys) {
                 id value= self[key];
                 [str appendFormat:@"\t \"%@\" = %@,\n",key, value];
             }
         [str appendString:@"}"];

         return str;
    
 }

+(NSString*)DataTOjsonString:(id)object
{
    NSString *jsonString = nil;
    NSError *error;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:object
                                                       options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string
                                                         error:&error];
    if (! jsonData) {
        NSLog(@"Got an error: %@", error);
    } else {
        jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    }
    return jsonString;
}
@end
